<?php
/**
 * 回复信息
 * 
 * @package ews
 * @ews Enterprise WorkShop
 * @version 1.0 alpha
 * @since 2011-05-04
 * @author monkee
 */

class replyModel extends model
{
	public function create($user_id, $username, $model_id,$message, $re_reply_id=0){
		$id = DB::insert('reply', array(
			'user_id' => $user_id,
			'username' => $username,
			're_reply_id' => $re_reply_id,
			'model_id' => $model_id,
			'message' => $message,
			'mktime' => TIMESTAMP
		));
		
		return $id;
	}
	
	
	
	public function get_replys($model_id,$count=40){
		$sql = 'SELECT * FROM '.DB::table('reply')." WHERE model_id=$model_id order by mktime desc limit $count";
		return DB::fetchArray($sql);
	}
	
	
}
?>